package com.happy.xiao.common.rabbitmq.util;

import org.springframework.amqp.core.Message;

import java.io.UnsupportedEncodingException;

public class MessageUtil {


    /**
     * 获取消息内容
     * @param message
     * @return
     */
    public static String getMessageContent(Message message) {

        try {
            if (message == null) return null;
            byte[] msg = message.getBody();
            return new String(msg, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }


}
